home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form formdes
- BackColor = &H00FFFFFF&
- Caption = "Automatically navigate thru pre-printed forms"
- ClientHeight = 6675
- ClientLeft = 345
- ClientTop = 330
- ClientWidth = 8655
- Height = 7080
- Left = 285
- LinkTopic = "Form1"
- ScaleHeight = 6675
- ScaleWidth = 8655
- Top = -15
- Width = 8775
- Begin CommandButton Command2
- BackColor = &H00C0C0C0&
- Caption = "&Tip"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 360
- Left = 5835
- TabIndex = 12
- Top = 1740
- Width = 1290
- End
- Begin CommandButton Command1
- BackColor = &H00C0C0C0&
- Caption = "&Print"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 360
- Left = 7215
- TabIndex = 0
- Top = 1740
- Width = 1290
- End
- Begin vsViewPort vp
- BackColor = &H00404040&
- ConvInfo = FORMDES.FRX:0000
- Height = 4290
- Left = 390
- Top = 2205
- VirtualHeight = 11100
- VirtualWidth = 8600
- Width = 8145
- Begin PictureBox picFax
- BackColor = &H00FFFFFF&
- Height = 11000
- Left = 60
- Picture = FORMDES.FRX:000B
- ScaleHeight = 10965
- ScaleWidth = 8475
- TabIndex = 10
- Top = 105
- Width = 8500
- Begin TextBox txtFax
- BackColor = &H00FFFFFF&
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00000000&
- Height = 315
- Index = 0
- Left = 4500
- TabIndex = 1
- Text = "01/01/01"
- Top = 315
- Width = 3000
- End
- Begin TextBox txtFax
- BackColor = &H00FFFFFF&
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00000000&
- Height = 315
- Index = 5
- Left = 4500
- TabIndex = 6
- Text = "Your name goes here"
- Top = 3735
- Width = 3000
- End
- Begin TextBox txtFax
- BackColor = &H00FFFFFF&
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "Courier New"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00000000&
- Height = 315
- Index = 6
- Left = 4485
- TabIndex = 7
- Top = 4425
- Width = 3000
- End
- Begin TextBox txtFax
- BackColor = &H00FFFFFF&
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "Courier New"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00000000&
- Height = 315
- Index = 7
- Left = 4500
- TabIndex = 8
- Text = "1"
- Top = 5070
- Width = 3000
- End
- Begin TextBox txtFax
- BackColor = &H0000FFFF&
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "Courier New"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00000000&
- Height = 3255
- Index = 8
- Left = 405
- MultiLine = -1 'True
- TabIndex = 9
- Top = 6435
- Width = 7575
- End
- Begin ComboBox cmbFax
- BackColor = &H00FFFFFF&
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 315
- Index = 0
- Left = 4500
- TabIndex = 2
- Top = 1005
- Width = 3000
- End
- Begin ComboBox cmbFax
- BackColor = &H00FFFFFF&
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 315
- Index = 1
- Left = 4500
- TabIndex = 3
- Top = 1680
- Width = 3000
- End
- Begin ComboBox cmbFax
- BackColor = &H00FFFFFF&
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 315
- Index = 2
- Left = 4500
- TabIndex = 4
- Top = 2355
- Width = 3000
- End
- Begin ComboBox cmbFax
- BackColor = &H00FFFFFF&
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 315
- Index = 3
- Left = 4500
- TabIndex = 5
- Top = 3060
- Width = 3000
- End
- End
- End
- Begin vsPrinter prt
- ConvInfo = FORMDES.FRX:1141
- FontName = "Times New Roman"
- FontSize = 11
- HdrFontBold = -1 'True
- HdrFontName = "Courier New"
- HdrFontSize = 14
- Height = 300
- Left = 7425
- PageBorder = 0 'None
- TableSep = "|;"
- Top = 495
- Visible = 0 'False
- Width = 1005
- End
- Begin Image Image1
- Height = 975
- Left = 150
- Picture = FORMDES.FRX:114C
- Top = 135
- Width = 6585
- End
- Begin Label Label1
- BackStyle = 0 'Transparent
- Caption = "Scan your forms and use standard VB controls on top of them"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 12
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 300
- Left = 180
- TabIndex = 11
- Top = 1125
- Width = 7305
- End
- Option Explicit
- Sub cmbFax_Click (index As Integer)
- Dim i%
- Static changing%
- If changing Then Exit Sub
- changing = True
- For i = 0 To 3
- If i <> index Then cmbFax(i).ListIndex = cmbFax(index).ListIndex
- Next
- changing = False
- End Sub
- Sub cmbFax_GotFocus (index As Integer)
- ShowMe cmbFax(index)
- End Sub
- Sub Command1_Click ()
- Dim i%
- Dim ml, mr, mt, mb
- Dim x, y, w
- Dim pw, ph
- ' prepare printer
- prt.Action = 3
- ml = prt.MarginLeft
- mr = prt.MarginRight
- mt = prt.MarginTop
- mb = prt.MarginBottom
- pw = prt.PageWidth - ml - mr
- ph = prt.PageHeight - mt - mb
- ' draw form
- prt.X1 = ml
- prt.X2 = prt.PageWidth - mr
- prt.Y1 = mt
- prt.Y2 = prt.PageHeight - mb
- prt.Picture = picfax.Picture
- ' draw each control
- prt.MarginBottom = -prt.PageHeight
- On Error Resume Next
- For i = 0 To controls.Count - 1
-
- ' adjust font
- prt.FontName = controls(i).FontName
- prt.FontBold = controls(i).FontBold
- prt.FontItalic = controls(i).FontItalic
- FontSize = controls(i).FontSize
- prt.FontSize = TextHeight("Hj") * ph / picfax.Height / 20
- ' adjust position
- x = ml + controls(i).Left * pw / picfax.Width
- y = mt + controls(i).Top * ph / picfax.Height
- w = controls(i).Width * pw / picfax.Width
- prt.MarginLeft = x
- prt.MarginRight = (pw + ml + mr) - x - w
- prt.MarginTop = y
- prt.CurrentX = prt.MarginLeft
- prt.CurrentY = prt.MarginTop
- prt = controls(i).Text
- Next i
- On Error GoTo 0
- ' all done
- prt.Action = 6
- prt.MarginLeft = ml
- prt.MarginRight = mr
- prt.MarginTop = mt
- prt.MarginBottom = mb
- End Sub
- Sub Command2_Click ()
- MsgBox "This demo also shows you how to automatically scroll the form with the keyboard. Just click on a field and press the TAB key."
- End Sub
- Sub Form_Load ()
- Dim i%
- ' this is a simple form-fill/print/preview application.
- ' the form is drawn in Visio, or Corel, or Excel, and saved
- ' as a metafile.
- ' the metafile is placed in a picture box, along with text
- ' and combo box controls. the controls go in the proper
- ' position to be filled out.
- ' the whole thing goes into a viewport. there's a routine
- ' that ensures the control with the focus is always visible for
- ' data entry. or the user can scroll with the viewport.
- ' to print, the vsprinter copies the form picture and then
- ' traverses the controls. if they are text or combo boxes they
- ' get printed at the proper position, with the proper font.
- ' this is a cool way to create smart forms with fields that
- ' depend on other fields etc. for example, a 1040, fax, travel
- ' expense report etc.
- txtFax(0) = Format$(Date$, "mmmm dd, yyyy")
- cmbFax(0).AddItem "Gustavo Eydelsteyn"
- cmbFax(1).AddItem "Videosoft"
- cmbFax(2).AddItem "(510) 843-0174"
- cmbFax(3).AddItem "(510) 704-8200"
- cmbFax(0).AddItem "Bill Gates"
- cmbFax(1).AddItem "Microsoft"
- cmbFax(2).AddItem "(206) 555-1000"
- cmbFax(3).AddItem "(206) 555-2000"
- cmbFax(0).AddItem "Phil Kahn"
- cmbFax(1).AddItem "Starfish"
- cmbFax(2).AddItem "(444) 555-1000"
- cmbFax(3).AddItem "(444) 555-2000"
- cmbFax(0).AddItem "Ray Noorda"
- cmbFax(1).AddItem "Novell"
- cmbFax(2).AddItem "(555) 555-1000"
- cmbFax(3).AddItem "(555) 555-2000"
- cmbFax(0).AddItem "Jim Manzi"
- cmbFax(1).AddItem "Lotus"
- cmbFax(2).AddItem "(666) 555-1000"
- cmbFax(3).AddItem "(666) 555-2000"
- cmbFax(0).AddItem "Lee Iacocca"
- cmbFax(1).AddItem "Chrysler"
- cmbFax(2).AddItem "(777) 555-1000"
- cmbFax(3).AddItem "(777) 555-2000"
- End Sub
- Sub Form_Resize ()
- vp.Width = scalewidth - vp.Left * 2
- vp.Height = scaleheight - vp.Top - vp.Left
- End Sub
- Sub ShowMe (c As Control)
- Dim v%, offset%
- offset = 400
- ' show right
- v = c.Left + c.Width + offset
- If v > vp.VirtualLeft + vp.Width Then vp.VirtualLeft = v - vp.Width
- ' show start
- v = c.Left - c.Width
- If v < vp.VirtualLeft Then vp.VirtualLeft = v
- ' show bottom
- v = c.Top + c.Height + offset
- If v > vp.VirtualTop + vp.Height Then vp.VirtualTop = v - vp.Height
- ' show top
- v = c.Top - offset
- If v < vp.VirtualTop Then vp.VirtualTop = v
- End Sub
- Sub txtFax_GotFocus (index As Integer)
- txtFax(index).SelStart = 0
- txtFax(index).SelLength = 1000
- ShowMe txtFax(index)
- End Sub
- Sub vp_Scroll ()
- ' to avoid drop combo to float
- Me.SetFocus
- End Sub
-